﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Detai.Web.Models.Organization>" %>
<%@ Import Namespace="Detai.Lib.Helpers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Chi tiết
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Header" runat="server">
	Đơn vị
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Toolbar" runat="server">
	<%= Html.Toolbar("Sửa", string.Format("/Organization/Edit/{0}", Model.ID), "edit")%>
	<%= Html.Toolbar("Xóa", string.Format("/Organization/Delete/{0}", Model.ID), "delete")%>
	<%= Html.Toolbar("Quay lại", "/Organization", "back")%>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%if(ViewData["MessageInfo"]==null){ %>
	<fieldset>
		<legend>Chi tiết</legend>
		<table class="admintable">
			<tbody><tr>
				<td class="key">Mã đơn vị</td>
				<td><%= Html.Encode(Model.Code) %></td>
			</tr>
			<tr>
				<td class="key">Tên đơn vị</td>
				<td><%= Html.Encode(Model.Name) %></td>
			</tr>
			<tr>
				<td class="key">Mô tả</td>
				<td><%= Html.Encode(Model.Description) %></td>
			</tr>
			<tr>
				<td class="key">Cập nhật lúc</td>
				<td><%= Html.Encode(String.Format("{0:g}", Model.Modified)) %></td>
			</tr></tbody>
		 </table>
	 </fieldset>
	 <% if (Model.Organizations.Count > 0 ) { %>
	 <fieldset>
		<legend>Các Khoa/phòng ban</legend>
		<table width="100%" class="adminlist">
			<tr>
				<th width="10" align="right">
					STT
				</th>
				<th width="30"></th>
				<th width="30"></th>
				<th>
					Tên bộ phận
				</th>
				<th>
					Cập nhật
				</th>
				<th>
					ID
				</th>
			</tr>
		<% 
			int i = 0;
    		foreach (var item in Model.Organizations) {
				i++;
		%>		
			<tr>
				<td align="right">
					<%= i.ToString() %>
				</td>
				<td align="center">
					<%= Html.ActionImage("Sửa", "icon-24-edit.png", "Department", "Edit", new Dictionary<string, object>(){{ "id", item.ID}})%>
				</td>
				 <td align="center">
					<%= Html.ActionImage("Xóa", "icon-24-delete.png", "Department", "Delete", new Dictionary<string, object>(){{ "id", item.ID}})%>
				</td>
				<td>
					<%= Html.ActionLink(item.Name, "Details", "Department", new { id = item.ID }, null)%>
				</td>
				<td>
					<%= Html.Encode(String.Format("{0:g}", item.Modified)) %>
				</td>
				<td>
					<%= Html.Encode(item.ID) %>
				</td>
			</tr>
	    
		<% } %>
		</table>
	</fieldset>
	<% } %>
<% } %>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="Message" runat="server">
    <%=ViewData["MessageInfo"]!=null? "<p class='perror'>"+Html.Encode(ViewData["MessageInfo"])+"</p>":string.Empty%>  
</asp:Content>

